/*
  In App.xaml:
  <Application.Resources>
      <vm:ViewModelLocator xmlns:vm="clr-namespace:NicoView"
                           x:Key="Locator" />
  </Application.Resources>
  
  In the View:
  DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}"

  You can also use Blend to do all this with the tool's support.
  See http://www.galasoft.ch/mvvm
*/

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
using GalaSoft.MvvmLight.Messaging;
using Microsoft.Practices.ServiceLocation;
using NicoView.Model.Service;
using NicoView.Model.Service.Events;
using NicoView.Model.Service.Lives;
using NicoView.ViewModel;
using NicoView.ViewModel.Platform;
using System;
using System.Windows;

namespace NicoView.ViewModelLocators
{
    
    /// <summary>
    /// This class contains static references to all the view models in the
    /// application and provides an entry point for the bindings.
    /// </summary>
    public class ViewModelLocator
    {
        
        /// <summary>
        /// Initializes a new instance of the ViewModelLocator class.
        /// </summary>
        public ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            ////if (NicoViewViewModelBase.IsInDesignModeStatic)
            ////{
            ////    // Create design time view services and models
            ////    SimpleIoc.Default.Register<IDataService, DesignDataService>();
            ////}
            ////else
            ////{
            ////    // Create run time view services and models
            ////    SimpleIoc.Default.Register<IDataService, DataService>();
            ////}



            SimpleIoc.Default.Register<NicoViewMainViewViewModel>();
            SimpleIoc.Default.Register<NicoViewAuthSetViewModel>();
            SimpleIoc.Default.Register<NicoViewIdInputViewModel>();
            SimpleIoc.Default.Register<NicoViewMainCommentListViewModel>();
            SimpleIoc.Default.Register<NicoViewSettingConsoleViewModel>();
            SimpleIoc.Default.Register<NicoViewCommentEditorViewModel>();
            SimpleIoc.Default.Register<NicoViewCommentControlViewModel>();
            SimpleIoc.Default.Register<NicoViewSelfUserViewModel>();
            SimpleIoc.Default.Register<NicoViewBroadcastConsolViewModel>();
            SimpleIoc.Default.Register<NicoViewBouyomichanViewModel>();
            SimpleIoc.Default.Register<NicoViewServiceViewModel>();
            SimpleIoc.Default.Register<NicoViewNiconicoLiveEncoderViewModel>();
            if (NicoViewViewModelBase.IsInDesignModeStatic)
            {

            }
            else
            {

            }
            

            
            
        }



        public NicoViewMainViewViewModel Main
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewMainViewViewModel>();
            }
        }

        

        public NicoViewAuthSetViewModel NicoAuthSetViewModel
        {

            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewAuthSetViewModel>();
 
            }
        }

        public NicoViewIdInputViewModel NicoViewIdInputViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewIdInputViewModel>();
            }
        }

        public NicoViewMainCommentListViewModel MainCommentListViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewMainCommentListViewModel>();
            }
        }

        public NicoViewSettingConsoleViewModel SettingConsoleViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewSettingConsoleViewModel>();
            }
        }

        public NicoViewCommentEditorViewModel NicoCommentEditorViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewCommentEditorViewModel>();
            }
        }

        public NicoViewCommentControlViewModel NicoViewCommentControlViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewCommentControlViewModel>();
            }
        }

        public NicoViewSelfUserViewModel SelfUserViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewSelfUserViewModel>();
            }
        }


        public NicoViewBroadcastConsolViewModel NicoViewBroadcastConsolViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewBroadcastConsolViewModel>();
            }
        }

        public NicoViewBouyomichanViewModel NicoViewBouyomichanViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewBouyomichanViewModel>();
            }
        }

        public NicoViewServiceViewModel NicoViewServiceViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewServiceViewModel>();
            }
        }

        public NicoViewNiconicoLiveEncoderViewModel NiconicoLiveEncoderViewModel
        {
            get
            {
                return ServiceLocator.Current.GetInstance<NicoViewNiconicoLiveEncoderViewModel>();
            }
        }

        public static void Cleanup()
        {
            // TODO Clear the ViewModels
        }
    }
     
}